<?php

namespace App\Models;

use \Illuminate\Database\Eloquent\Model;

class Detail extends Model
{
    protected $table = 'tb_detail';// 表名
    public $fillable = ['goods_id', 'goods_name', 'num', 'totalprice', 'time', 'goods_match_id', 'order_id', 'id'];
    public $timestamps = false;// 关闭后  create方法不会修改 created_at updated_at 的值

    public $primaryKey = 'id';//主键默认是id  不是的话需要配置


    public function goods()
    {
        return $this->hasOne(Goods::class, 'goods_id', 'goods_id');
    }
    public function match()
    {
        return $this->hasOne(Match::class, 'goods_id', 'goods_id');
    }
}
